import { NextApiRequest, NextApiResponse } from "next";

import { delEndpoint } from "@/services";

async function removeEndpoint(
  req: NextApiRequest,
  res: NextApiResponse<APIRes>
) {
  await delEndpoint(req, res);
}

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse<APIRes>
) {
  if (req.method === "POST") {
    removeEndpoint(req, res);
  } else {
    res
      .status(405)
      .json({ success: false, data: {}, message: "Method not allowed" });
  }
}
